package com.hdcircles.autoform.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

import javax.inject.Inject;

/**
 * Created by hdcircles on 2016/9/27.
 */

public class FormBean  implements Parcelable {



    private String FormId;

    private String Id;

    private String FormName;

    private List<QuestionBean> Question;

    private Long Time;

    private Integer Status;

    private Integer Quantity;

    private Integer Shared ;

    private String Receiver;

    private String Creator;

    private List<UserFormBean> User_Form;

    private String Writer;

    private String WriterName;

    private String Address;

    private String TableId;


    @Inject
    public FormBean() {
    }

    public String getFormId() {
        return FormId;
    }

    public void setFormId(String formId) {
        FormId = formId;
    }

    public String getId() {
        return Id;
    }

    public void setId(String id) {
        this.Id = id;
    }

    public String getFormName() {
        if (null==FormName) FormName="未命名";
        return FormName;
    }

    public void setFormName(String formName) {
        this.FormName = formName;
    }

    public List<QuestionBean> getQuestion() {
        return Question;
    }

    public void setQuestion(List<QuestionBean> question) {
        this.Question = question;
    }

    public Long getTime() {
        return Time;
    }

    public void setTime(Long time) {
        this.Time = time;
    }

    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        this.Status = status;
    }

    public Integer getQuantity() {
        if (null==Quantity) return 0;
        return Quantity;
    }

    public void setQuantity(int quantity) {
        this.Quantity = quantity;
    }

    public int getShared() {
        if (null==Shared) return 0;
        return Shared;
    }

    public void setShared(int shared) {
        this.Shared = shared;
    }

    public String getReceiver() {
        return Receiver;
    }

    public void setReceiver(String receiver) {
        this.Receiver = receiver;
    }

    public String getCreator() {
        return Creator;
    }

    public void setCreator(String creator) {
        this.Creator = creator;
    }

    public String getTableId() {
        return TableId;
    }

    public void setTableId(String tableId) {
        TableId = tableId;
    }

    public String getAddress() {
        return Address;
    }

    public void setAddress(String address) {
        Address = address;
    }

    public List<UserFormBean> getUser_Form() {
        return User_Form;
    }

    public void setUser_Form(List<UserFormBean> user_Form) {
        User_Form = user_Form;
    }

    public String getWriter() {
        return Writer;
    }

    public void setWriter(String writer) {
        Writer = writer;
    }

    public String getWriterName() {
        return WriterName;
    }

    public void setWriterName(String writerName) {
        WriterName = writerName;
    }

    @Override
    public String toString() {
        return "FormBean{" +
                "Id='" + Id + '\'' +
                ", FormName='" + FormName + '\'' +
                ", Question=" + Question +
                ", Time=" + Time +
                ", Status=" + Status +
                ", Quantity=" + Quantity +
                ", Shared=" + Shared +
                ", Receiver='" + Receiver + '\'' +
                ", Creator='" + Creator + '\'' +
                '}';
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.FormId);
        dest.writeString(this.Id);
        dest.writeString(this.FormName);
        dest.writeTypedList(this.Question);
        dest.writeValue(this.Time);
        dest.writeValue(this.Status);
        dest.writeValue(this.Quantity);
        dest.writeValue(this.Shared);
        dest.writeString(this.Receiver);
        dest.writeString(this.Creator);
        dest.writeTypedList(this.User_Form);
        dest.writeString(this.Writer);
        dest.writeString(this.WriterName);
        dest.writeString(this.Address);
        dest.writeString(this.TableId);
    }

    protected FormBean(Parcel in) {
        this.FormId = in.readString();
        this.Id = in.readString();
        this.FormName = in.readString();
        this.Question = in.createTypedArrayList(QuestionBean.CREATOR);
        this.Time = (Long) in.readValue(Long.class.getClassLoader());
        this.Status = (Integer) in.readValue(Integer.class.getClassLoader());
        this.Quantity = (Integer) in.readValue(Integer.class.getClassLoader());
        this.Shared = (Integer) in.readValue(Integer.class.getClassLoader());
        this.Receiver = in.readString();
        this.Creator = in.readString();
        this.User_Form = in.createTypedArrayList(UserFormBean.CREATOR);
        this.Writer = in.readString();
        this.WriterName = in.readString();
        this.Address = in.readString();
        this.TableId = in.readString();
    }

    public static final Parcelable.Creator<FormBean> CREATOR = new Creator<FormBean>() {
        @Override
        public FormBean createFromParcel(Parcel source) {
            return new FormBean(source);
        }

        @Override
        public FormBean[] newArray(int size) {
            return new FormBean[size];
        }
    };
}
